import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'eroll',
    component: () => import( '@/views/EnrollView.vue'),
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
 
  {
    path: '/login',
    name: 'login',
    component: () => import( '@/views/LogonView.vue'),
  },
  {
    path: '/search',
    name: 'search',
    component: () => import( '@/views/SearchView.vue'),
    children:[
      {
        path:'/',
        name: 'indexs',
        component: () => import( '@/twostagerouter/SearchIndex.vue'),
      },
      {
        path:'result',
        name: 'result',
        component: () => import( '@/twostagerouter/SearchResult.vue'),
      }
    ]

  },
  {
    path: '/collect',
    name: 'collect',
    component: () => import( '@/views/CollectView.vue'),
    children:[
      {
        path:'/',
        name: 'nan',
        component: () => import( '@/twostagerouter/PaihangNan.vue'),
      },
      {
        path:'nv',
        name: 'nv',
        component: () => import( '@/twostagerouter/PaihangNv.vue'),
      }
    ]
  },
  {
    path: '/user',
    name: 'user',
    component: () => import( '@/views/UserView.vue'),
    children:[
      {
        path:'/',
        name: 'index',
        component: () => import( '@/twostagerouter/UserIndex.vue'),
      },
     
      {
        path:'shezhi',
        name: 'shezhi',
        component: () => import( '@/twostagerouter/SheZhi.vue'),
      },
      {
        path:'shoucang',
        name: 'shoucang',
        component: () => import( '@/twostagerouter/ShouCang.vue'),
      },
     
    ]
  },
  {
    path: '/manhua',
    name: 'manhua',
    component: () => import( '@/views/ManHuaView.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to){
  return VueRouterPush.call(this, to).catch(err=>err)
}
export default router
